<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">

    <title>Login</title>

    <?php $this->load->view('library/header');?>
</head>

<body class="login-body">

<div class="container">

    <form id="signin" class="form-signin" method="post" action="">
        <div class="form-signin-heading text-center">
            <h1 class="sign-title">登录图量科技多平台</h1>
            <img style="width: 100%;" src="/public/images/login-logo.png" alt=""/>
        </div>
        <div class="login-wrap">
            <div class="alert-login">

            </div>
            <input type="text" name="username" class="form-control" placeholder="User ID" autofocus>
            <input type="password" name="password" class="form-control" placeholder="Password">

            <button class="btn btn-lg btn-login btn-block" type="submit">
                <i class="fa fa-check"></i>
            </button>

            <div class="registration">
                Not a member yet?
                <a class="" href="registration.html">
                    Signup
                </a>
            </div>
            <label class="checkbox">
                <input type="checkbox" value="remember-me"> Remember me
                <span class="pull-right">
                    <a data-toggle="modal" href="#myModal"> Forgot Password?</a>

                </span>
            </label>

        </div>

        <!-- Modal -->
        <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="myModal" class="modal fade">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">Forgot Password ?</h4>
                    </div>
                    <div class="modal-body">
                        <p>Enter your e-mail address below to reset your password.</p>
                        <input type="text" name="email" placeholder="Email" autocomplete="off" class="form-control placeholder-no-fix">

                    </div>
                    <div class="modal-footer">
                        <button data-dismiss="modal" class="btn btn-default" type="button">Cancel</button>
                        <button class="btn btn-primary" type="button">Submit</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- modal -->

    </form>

</div>



<?php $this->load->view('library/footer');?>
<script type="text/javascript">
    $(function () {
        $('#signin').submit(function () {

            var data = new FormData(this);

            $.ajax({
                type: 'POST',
                url: '<?php echo base_url('Login/'); ?>',
                data: data,
                success: function (data) {
                    if (data.status === 'warning') {
                        $('.alert-login').html('<div class="alert alert-block alert-danger fade in" ><button type="button" class="close close-sm" data-dismiss="alert"><i class="fa fa-times"></i></button><strong>' + data.info + '</strong></div>');
                    } else if (data.status === 'success') {
                        window.location.href = '<?php echo base_url('/'); ?>';
                    }
                },
                dataType:'json',
                cache: false,
                contentType: false,
                processData: false
            });

            return false;
        });
    });
</script>
</body>
</html>
